from pathlib import Path
import zipfile

# 解压的目标路径
target_path = Path.cwd()
zippath = Path('test.zip')
# 创建ZipFile对象
zip_file = zipfile.ZipFile(zippath)
# 返回zip文件中包含的所有文件和文件夹列表
names = zip_file.namelist()
# 获得压缩文件中某个文件的属性数据
file_info = zip_file.getinfo('test/1.txt')
print(f'压缩前大小：{file_info.file_size}')
print(f'压缩后大小：{file_info.compress_size}')

# 解压
zip_file.extractall(target_path)
zip_file.close()
print('done!')